@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

.body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  height: 100vh;
  width: 100vw;
  background-color: skyblue;
  overflow: hidden;
  position: relative;

  .counter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;

    &.hide {
      transform: translate(-50%, -50%) scale(0);
      animation: hide 0.2s ease-out;
    }

    .nums {
      color: #3498db;
      font-size: 50px;
      position: relative;
      overflow: hidden;
      width: 250px;
      height: 50px;

      span {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(120deg);
        transform-origin: bottom center;

        &.in_out {
          transform: translate(-50%, -50%) rotate(0deg);
          animation: goInOut 1s ease-in-out var(--infinite);
        }
      }
    }

    h4 {
      font-size: 20px;
      margin: 5px;
      text-transform: uppercase;
    }
  }

  .final {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    text-align: center;

    &.show {
      transform: translate(-50%, -50%) scale(1);
      animation: show 0.2s ease-out;
    }

    .replay {
      background-color: #3498db;
      border-radius: 3px;
      border: none;
      color: aliceblue;
      padding: 5px;
      text-align: center;
      display: inline-block;
      cursor: pointer;
      transition: all 0.3s;

      span {
        cursor: pointer;
        display: inline-block;
        position: relative;
        transition: 0.3s;

        &:after {
          content: '\00bb';
          position: absolute;
          opacity: 0;
          top: 0;
          right: -20px;
          transition: 0.5s;
        }
      }

      &:hover {
        span {
          padding-right: 25px;

          &:after {
            opacity: 1;
            right: 0;
          }
        }
      }
    }
  }

}

@keyframes hide {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    transform: translate(-50%, -50%) scale(0);
  }
}


@keyframes show {
  0% {
    transform: translate(-50%, -50%) scale(0);
  }

  30% {
    transform: translate(-50%, -50%) scale(1.4);
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes goInOut {
  0% {
    transform: translate(-50%, -50%) rotate(120deg);
  }

  20% {
    transform: translate(-50%, -50%) rotate(-20deg);
  }

  40% {
    transform: translate(-50%, -50%) rotate(10deg);
  }

  60% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  80% {
    transform: translate(-50%, -50%) rotate(20deg);
  }

  100% {
    transform: translate(-50%, -50%) rotate(-120deg);
  }

}

// @keyframes goOut {
//   0% {
//     transform: translate(-50%, -50%) rotate(0deg);
//   }

//   60% {
//     transform: translate(-50%, -50%) rotate(20deg);
//   }

//   100% {
//     transform: translate(-50%, -50%) rotate(-120deg);
//   }
// }